home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / mtgrap1c / demo12.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-13  |  2.0 KB  |  87 lines

  1. /*                                                            
  2.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  3.   ▒                                                          ▒
  4.   ▒                                                          ▒
  5.   ▒             Neuromancer's Graphics Library               ▒
  6.   ▒                     Version 1.0c                         ▒
  7.   ▒                                                          ▒
  8.   ▒   This program displays a WGT sprite file.               ▒
  9.   ▒                                                          ▒ 
  10.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  11.   ▒                                                          ▒
  12.   ▒     Project:    MTLIB01.LIB                              ▒
  13.   ▒                 DEMO12.CPP                               ▒
  14.   ▒                                                          ▒ 
  15.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  16. */
  17. #include <iostream.h>
  18. #include <stdlib.h>
  19. #include <conio.h>
  20. #include <dos.h>
  21. #include "video.h"
  22. #include "bitmap.h"
  23. #include "palette.h"
  24.  
  25.  
  26. extern WGTSPRITE_HEADER *wgt_header;
  27.  
  28. void main(int argc, char *argv[])
  29. {
  30.     WGTSPRITE    **sprite;
  31.     byte           palette[768];
  32.     int        width;
  33.  
  34.     if (argc!=2)
  35.     {
  36.         cout << "Usage : demo12 <filename> "<<endl;
  37.         cout << "        where filename is a WGT <.spr> file"<< endl;
  38.         exit(0);
  39.     }
  40.     
  41.     if((sprite=mtLoadWGT(argv[1],palette))==NULL)
  42.     {    
  43.         mtSetTextMode();
  44.         cout << "Error loading " << argv[1] << endl;
  45.         cout <<  "WGT sprite file required <.spr>" << endl;
  46.         exit(0);
  47.     }
  48.  
  49.     mtSetVGAMode();
  50.  
  51.     mtSetPal(palette,0,255);
  52.  
  53.     width=5;
  54.  
  55.     int last = 5;
  56.  
  57.     if (last > (wgt_header->total))
  58.     {
  59.         last = wgt_header->total;
  60.     }
  61.     
  62.     for(int i = 0; i <= last; i++)
  63.     {    
  64.         mtCPutSprite(width,10,sprite[i]->width, sprite[i]->height,sprite[i]->data);
  65.         width += sprite[i]->width +5;
  66.     }
  67.     
  68.     getch();
  69.  
  70.     mtFreeWGT(sprite);
  71.     
  72.     mtSetTextMode();
  73.  
  74.     cout << "Thank you for using the library!" << endl;
  75.  
  76.     exit(0);
  77.     
  78.     
  79. }
  80.  
  81.            
  82.             
  83.  
  84.            
  85.  
  86.            
  87.